package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.JwtTokenUtils;
import com.example.entity.Admin;
import com.example.entity.Params;
import com.example.entity.Type;
import com.example.exception.CustomException;
import com.example.mapper.AdminMapper;
import com.example.mapper.TypeMapper;
import com.example.service.AdminService;
import com.example.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Collections;
import java.util.List;

@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {
    @Autowired
    private TypeMapper typeMapper;


    @Override
    public List<Type> findBySearch(Params params) {
        return typeMapper.findBySearch(params);
    }

    @Override
    public void add(Type type) {
        if (type.getId() == null){
            this.save(type);
        }else {
            this.saveOrUpdate(type);
        }
    }
}
